function[IRF]=Beta_VAR_to_IRF(Phi,A0,p,h)
% Viet Hoang Dinh
% Monash University
% Edited December 2024

%%
[N]=size(Phi,2);

Phi_int=Phi(2:end,:);
F_var = [Phi_int';eye(N*(p-1)) zeros(N*(p-1),N)];
bigeye= [eye(N) zeros(N,N*(p-1))];


for j= h+1
    IRF = reshape(bigeye*(F_var^(j-1))*bigeye'*A0,[],1);
end


end